package com.ruibang.glass.material.controller.cp;

import com.ruibang.glass.material.domain.req.bcp.ManageBCPLocationReq;
import com.ruibang.glass.material.entity.cp.MaterialCPLocationManagement;
import com.ruibang.glass.material.service.cp.GMaterialCPLocationManagementService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 成品库位管理 前端控制器
 * </p>
 *
 * @author mameng
 * @since 2024-02-05
 */
@RestController
@RequestMapping("/api/material/cp/local/management")
@Api(value="成品库位管理",tags={"成品库位管理"})
public class MaterialCPLocationManagementController {

    @Autowired
    private GMaterialCPLocationManagementService materialLocationManagementService;


    @PostMapping("/list")
    @ApiOperation(value = "成品库库位管理列表", response = ResultBody.class)
    public ResultBody getPageList(@RequestBody ManageBCPLocationReq manageLocationReq) {
        return ResultBody.success(materialLocationManagementService.getPage(manageLocationReq));
    }

    @PostMapping("/addMaterialLocationManagement")
    @ApiOperation(value = "更新", response = ResultBody.class)
    public ResultBody addMaterialLocationManagement(@RequestBody MaterialCPLocationManagement materialManagement) {
        return ResultBody.success(materialLocationManagementService.save(materialManagement));
    }

    @GetMapping("/getOne/{id}")
    @ApiOperation(value = "打印", response = ResultBody.class)
    public ResultBody getOneById(@PathVariable("id") String id) {
        return ResultBody.success(materialLocationManagementService.getById(id));
    }

    @PostMapping("/updateMaterialLocationManagement")
    @ApiOperation(value = "更新", response = ResultBody.class)
    public ResultBody updateMaterialLocationManagement(@RequestBody MaterialCPLocationManagement materialManagement) {
        return ResultBody.success(materialLocationManagementService.updateById(materialManagement));
    }






}
